ARG PROJECT_ID
ARG FLUTTER_CHANNEL
ARG BUILD_SHA

FROM gcr.io/$PROJECT_ID/flutter:$FLUTTER_CHANNEL

WORKDIR /
COPY . .

WORKDIR /pkgs/dart_services

RUN dart pub get
RUN dart compile exe bin/server.dart -o bin/server

RUN dart tool/grind.dart build-project-templates
RUN dart tool/grind.dart build-storage-artifacts

ENV BUILD_SHA=$BUILD_SHA

EXPOSE 8080
CMD ["/app/bin/server"]
